﻿Chenxin.UI.ContractPrintMgr=Chenxin.extend(Chenxin.UI.PageCommon,{
	actionUrl:'/service/logic/ContractPrintMgr.ashx',
	initEvent:function(){
		var _this=this;
		$('#btn_edit').click(function(){
			if(!_this.currentId){
				alert('请选择一条记录！');
				return false;
			}
			window.location.href='/page/ContractInfo/ContractInfo.aspx?contract_id='+_this.currentId;
		});
		
		$('#btn_destory').click(function(){
			_this.changeStatus(0);
		});
		
		$('#btn_print').click(function(){
			if(!_this.currentId){
				alert('请选择一条记录！');
				return false;
			}
			if(_this.grid.getCurrentField('Contract_Status')==0){
				alert('此合同已经作废，不能执行此操作！');
				return false;
			}
			window.location.href='/page/ContractInfo/ContractViewPrint.aspx?contract_id='+_this.currentId;
		});
	},
	createGrid:function(){
		return new Chenxin.UI.JsonGrid({
			actionUrl:this.actionUrl+'?op=getlist',
			scope:this,
			renderTo:'contract_datalist',
			modelId:'ContractPrint_ID',
			title:'打印记录列表',
			columns:{
				ContractPrint_ID:{
					head:'id',
					create:false
				},
				Contract_Id:{
					head:'合同id',
					create:false
				},
				Contract_Code:{
					head:'预成交编号',
					width:120,
					sortable:true
				},
				User_ID:{
					head:'打印人ID',
					create:false
				},
				User_Name:{
					head:'打印人',
					width:100,
					sortable:true
				},
				ContractPrint_Reason:{
					head:'打印原因',
					width:350
				},
				ContractPrint_Date:{
					head:'打印时间',
					width:120,
					sortable:true
				}
			}
		})
	},
	createSearch:function(){
		return new Chenxin.UI.ContractPrintSearch({
			scope:this
		});
	},
	initComponent:function(){
		Chenxin.UI.ContractPrintMgr.superclass.initComponent.call(this);
	}
});

Chenxin.UI.ContractPrintSearch=Chenxin.extend(Chenxin.UI.SearchCommon,{
	id: 'contractinfo_search',
    initEvent: function() {
        var _this = this;
        $('#btnSearch').click(function() {
            _this.scope.reloadGrid("",0);
        });
    },
    initComponent: function() {
        Chenxin.UI.ContractPrintSearch.superclass.initComponent.call(this);
    }
});

getcity = true; //设置需要获取城市下拉框数据

$(document).ready(function(){
	var cm=new Chenxin.UI.ContractPrintMgr();
});